import React, { Component } from 'react'
import { View, Text,Button } from '@tarojs/components'
import { connect } from 'react-redux'
import Taro from '@tarojs/taro'
import './index.less'
// function mapStateToProps(state) {
//   return { thread: state.thread }
//  }
//   const mapDispatchToProps = dispatch => {
//      return {
//        changeApp: data => dispatch({ type: 'CHANGE', data })
//      }
//    }
// @connect(({thread})=>({thread}),mapDispatchToProps)

 class Index extends Component {
  state= {
    name:'sjy'
  }
  componentWillMount () { }

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }
  toWhere(url) {
    Taro.navigateTo({
      url:`/pages/${url}`
    })
  }
  render () {
    return (
      <View className='index'>
        <Text>Hello world!</Text>
        <Button onClick={()=>{this.toWhere('my/index')}}>去my</Button>
        <Button onClick={()=>{this.toWhere('user/index')}}>去user</Button>

      </View>
    )
  }
}

export default Index
